import { View } from "@tarojs/components";
import { Icon } from "@/components";
import style from "./index.module.scss";
import { navigateTo } from "@/utils/navigation";

type InvoiceListItemProps = {
  orderNo: string;
  payTime: string;
  name: string;
  payPrice: string;
};

export const C44InvoiceListItem = ({
  orderNo,
  payTime,
  name,
  payPrice,
}: InvoiceListItemProps) => {
  return (
    <View
      className={style["invoice-list-item-wrapper"]}
      onClick={() => {
        navigateTo(`pages/user-order-details/index?orderNo=${orderNo}`);
      }}
    >
      <View>{payTime}</View>
      <View className={style["flex-row"]}>
        <View className={style["dark-text"]}>{name}</View>
        <Icon type={"ArrowBlack"} className={style.arrow} />
      </View>
      <View className={style["flex-row"]}>
        <View>订单号：{orderNo.replace("order", "")}</View>
        <View className={`${style["flex-row"]} ${style["price-row"]}`}>
          <View>合计</View>
          <View className={style["dark-text"]}>￥ {parseFloat(payPrice).toFixed(2)}</View>
        </View>
      </View>
    </View>
  );
};
